import _00GraphFuc as gf
import _00GraphTreeFuc as gt

#霍夫曼编码
W=[[0.08,'a'],[0.10,'b'],[0.12,'c'],[0.15,'d'],[0.20,'e'],[0.35,'f']]
W=sorted(W)
tree = gt.Huffmantree(W)
codelist =gt.HuffmanCoding(tree)
gtree =gt.Huffmantree2graph(tree)
gf.drawgraph(gtree)
print(tree)
print(gtree)
print(codelist)